package com.twu.bibilioteca;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: dixithk
 * Date: 6/12/14
 * Time: 2:31 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserInterfaceApp implements  UserInterface{

    Scanner request = new Scanner(System.in);



    
    public void  displayMenuOptions(List<String> optionsForDisplay)
    {
       for(int index=0 ; index<optionsForDisplay.size() ; index++)
       {
             System.out.println(String.valueOf(index+1) + " "+ optionsForDisplay.get(index));
       }

    }
    public boolean display(String resultLine)
    {
         System.out.println(resultLine)  ;
        return true;
    }

    @Override
    public String takeInputFromUserForCheckOut() {
        
        System.out.println("Enter the Book for Checking out\n");
        return request.nextLine();
        
    }


    public void printConclusion(Result c)
    {
        System.out.println(c.getAnswer());
//        System.out.println(c.getOkay());

    }
    
    public void printBooks(ArrayList<Book> books)
    {
        for(Book book :books)
        {
            String result = String.format("%-20s %s %s ",book.getTitle() , book.getAuthor(), String.valueOf(book.getPublishedYear() ));
            System.out.println(result);
        }

    }

    //"%-20s %s",book.getTitle() + book.getAuthor() + String.valueOf(book.getPublishedYear())

    @Override
    public String takeUserChoice()
    {
        System.out.println("Enter the choice");
        return request.nextLine();
    }

    @Override
    public String takeInputFromUserForReturn() {
        System.out.println("Enter the Book name for returning out");
        return request.nextLine();

    }

    public void UnsuccessfulReturn() {


        System.out.println("That is not a valid book to return");
    }
}
